package uia.alumni.group;

import java.io.PrintWriter;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
import javax.servlet.http.HttpServletRequest;
import uia.alumni.data.Role;
import uia.alumni.data.User;
import uia.alumni.web.Page;

public class EditGroup extends Page implements Constants {

    /** SERVLET_NAME is used for consistency checking of web.xml */
    public static final String SERVLET_NAME = "group.edit";
    @PersistenceUnit(name = PERSISTENCE_UNIT)
    private EntityManagerFactory emf;

    public EditGroup() {
        super(Role.member);
        // Må Fikse Member role for grupper
    }

    public void writeBody(PrintWriter out, HttpServletRequest request) {
        EntityManager em = emf.createEntityManager();

        try {
            User user = getLoggedInUser(em, request);

            if (user != null) {
                out.println("<h1>Edit Group</h1>");
                printStartForm(out, SaveGroup.SERVLET_NAME);

            }
        } finally {
        }


    }
    public final static long serialVersionUID = 1;
}
